<?php
// $Id$

/**
 * Controller_Memes controller
 */
class Controller_Memes extends Controller_Abstract
{

	function actionIndex()
	{
		# $this->_view['text'] = 'Hello!';
		$tests=Memes::find()->getAll();
		//print_r($tests);
		$this->_view['tests'] = $tests;
	}

	function actionSavememe()
	{
		# $this->_view['text'] = 'Hello!';

		
		$fh = fopen("e:\\zhongyong.txt", "rb");
		$data = fread($fh, filesize("e:\\zhongyong.txt"));
		fclose($fh);
		$arr = explode('#', $data);

		foreach($arr as $key=>$memes){

			$memearr = explode('@', $memes);

			foreach($memearr as $quotekey=>$v){
				$meme = new Memes(array(
				'meme'     => $v,
				));
				//print_r($meme);
				//echo $meme->memeid;
				$meme->save();
				//echo $meme->id;
				}

		}
	}


	function actionGetnotes()
	{
		# $this->_view['text'] = 'Hello!';

		$id=isset($_GET['id'])?$_GET['id']:"";
		$tests=Notes::find('memeid='.$id)->getAll();
		print_r($tests);
		//$this->_view['tests'] = $tests;
	}



}


